package cn.sxt.userscenter.outer.impl;

import org.springframework.stereotype.Service;

import com.alibaba.fastjson.JSONObject;

import cn.sxt.userscenter.common.util.ConstatFinaUtil;
import cn.sxt.userscenter.outer.service.IOuterService;

@Service("outerService")
public class OuterServiceImpl implements IOuterService
{
	@Override
	public JSONObject verifyUsersTokenService(JSONObject reqJSON)
	{
		JSONObject resultJSON = new JSONObject() ; 
		/* 取出token */
		JSONObject dataJSON = reqJSON.getJSONObject("data");
		String token = dataJSON.getString("token")  ; 
		
		JSONObject usersJSON = ConstatFinaUtil.TOKEN_MAP.get(token);
		
		if(usersJSON != null)
		{
			JSONObject dataResJSON = new JSONObject() ; 
			dataResJSON.put("users", usersJSON);
			
			resultJSON.put("data", dataResJSON);
			
			resultJSON.put("code", "1");
			resultJSON.put("info", ConstatFinaUtil.INFO_JSON.get("1"));
		}else
		{
			/* 木有取到结果 */
			resultJSON.put("code", "5");
			resultJSON.put("info", ConstatFinaUtil.INFO_JSON.get("5"));
		}
		return resultJSON;
	}
}

